<template>
	<view id="domxee-content" :class="globalData.defaultThemes">
		<view id="header_wrapper">
			<nii-navbar :globalData="globalData" :scroll="scroll" back>
				<view slot="title">
					<view id="title" class="fw-bolder">{{renders.main_title}}</view>
				</view>
			</nii-navbar>
		</view>
		<view id="content_wrapper">
			<view id="infos">
				<view class="infos d-padding">
					<view class="infos_box section">
						<view class="rows">
							<!-- <view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.avatar.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe7de;</view>
									<view class="name fw-bolder">{{renders.infos.avatar.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text">
									<view class="avatar_box" @click="uploadAvatar">
										<u--image :src="renders.infos.avatar.value" width="80rpx" height="80rpx" radius="80rpx"  mode="aspectFit" :bgColor="globalData.colors.current.section" class="avatar">
										  <template v-slot:loading>
										     <image src="@/static/media/images/loading.png" mode="aspectFit"></image>
										  </template>
										  <template v-slot:error>
										     <image src="@/static/media/images/loading.png" mode="aspectFit"></image>
										  </template>
										</u--image>
									</view>
									<view class="domxee_icon">&#xe632;</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.nickname.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe7ae;</view>
									<view class="name fw-bolder">{{renders.infos.nickname.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="shows.nickname = true">
									<view class="text">{{renders.infos.nickname.value}}</view>
									<view class="domxee_icon">&#xe632;</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.gender.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe7e2;</view>
									<view class="name fw-bolder">{{renders.infos.gender.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="shows.gender = true">
									<view class="text">{{renders.infos.gender.value}}</view>
									<view class="domxee_icon">&#xe632;</view>
								</view>
							</view> -->
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.mobile.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe7b2;</view>
									<view class="name fw-bolder">{{renders.infos.mobile.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="shows.mobile = true">
									<view class="text">{{renders.infos.mobile.value}}</view>
									<view class="domxee_icon">&#xe632;</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.password.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe7c0;</view>
									<view class="name fw-bolder">{{renders.infos.password.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="shows.password = true">
									<view class="text color fw-bolder">{{renders.infos.password.value}}</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.pay_password.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe7c0;</view>
									<view class="name fw-bolder">{{renders.infos.pay_password.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="shows.pay_password = true">
									<view class="text color fw-bolder">{{renders.infos.pay_password.value}}</view>
								</view>
							</view>
							<!-- <view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.mp_wechat_open_id.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe774;</view>
									<view class="name fw-bolder">{{renders.infos.mp_wechat_open_id.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="unbindAction('mp_wechat_open_id')">
									<view class="text color fw-bolder">{{renders.infos.mp_wechat_open_id.value}}</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.app_wechat_open_id.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe773;</view>
									<view class="name fw-bolder">{{renders.infos.app_wechat_open_id.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="unbindAction('app_wechat_open_id')">
									<view class="text color fw-bolder">{{renders.infos.app_wechat_open_id.value}}</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.mini_wechat_open_id.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe776;</view>
									<view class="name fw-bolder">{{renders.infos.mini_wechat_open_id.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="unbindAction('mini_wechat_open_id')">
									<view class="text color fw-bolder">{{renders.infos.mini_wechat_open_id.value}}</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.qq_token.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe777;</view>
									<view class="name fw-bolder">{{renders.infos.qq_token.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="unbindAction('qq_token')">
									<view class="text color fw-bolder">{{renders.infos.qq_token.value}}</view>
								</view>
							</view>
							<view class="row d-flex justify-content-between align-items-center" v-if="renders.infos.weibo_token.enable">
								<view class="left d-flex align-items-center">
									<view class="domxee_icon fw-bolder">&#xe775;</view>
									<view class="name fw-bolder">{{renders.infos.weibo_token.name}}</view>
								</view>
								<view class="right d-flex align-items-center vice_text" @click="unbindAction('weibo_token')">
									<view class="text color fw-bolder">{{renders.infos.weibo_token.value}}</view>
								</view>
							</view> -->
						</view>
					</view>
				</view>
			</view>
			<!-- <view id="tools">
				<view class="tools d-padding">
					<view class="tools_box section">
						<view class="tool d-flex justify-content-between align-items-center" v-if="renders.tools.feedback.enable" @click="navigateAction('account.feedback')">
							<view class="left d-flex align-items-center">
								<view class="domxee_icon fw-bolder">&#xe6a3;</view>
								<view class="name fw-bolder">{{renders.tools.feedback.name}}</view>
							</view>
							<view class="right">
								<view class="domxee_icon vice_text">&#xe632;</view>
							</view>
						</view>
						<view class="tool d-flex justify-content-between align-items-center" v-if="renders.tools.clear.enable" @click="clearCache">
							<view class="left d-flex align-items-center">
								<view class="domxee_icon fw-bolder">&#xe900;</view>
								<view class="name fw-bolder">{{renders.tools.clear.name}}</view>
							</view>
							<view class="right d-flex align-items-center vice_text">
								<view class="text">{{renders.tools.clear.value}}</view>
								<view class="domxee_icon vice_text">&#xe632;</view>
							</view>
						</view>
						<view class="tool d-flex justify-content-between align-items-center" v-if="renders.tools.version.enable">
							<view class="left d-flex align-items-center">
								<view class="domxee_icon fw-bolder">&#xe7d9;</view>
								<view class="name fw-bolder">{{renders.tools.version.name}}</view>
							</view>
							<view class="right d-flex align-items-center vice_text">
								<view class="text">{{renders.tools.version.value}}</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view id="destroy" v-if="renders.destroy.enable">
				 <view class="destroy d-padding">
					 <view class="destroy_box section">
						 <view class="row d-flex justify-content-between align-items-center" @click="shows.destroy = true">
						 	<view class="left d-flex align-items-center">
						 		<view class="domxee_icon fw-bolder">&#xe69b;</view>
						 		<view class="name fw-bolder">{{renders.destroy.name}}</view>
						 	</view>
						 	<view class="right d-flex align-items-center vice_text">
						 		<view class="text">{{renders.destroy.value}}</view>
						 		<view class="domxee_icon vice_text">&#xe632;</view>
						 	</view>
						 </view>
					 </view>
				 </view>
			</view>
			<view id="switch" v-if="renders.switch.enable">
				 <view class="switch d-padding">
					 <view class="switch_box section">
						 <view class="row d-flex justify-content-between align-items-center" @click="navigateAction(renders.switch.alias, renders.switch.params)">
						 	<view class="left d-flex align-items-center">
						 		<view class="domxee_icon fw-bolder">&#xe65d;</view>
						 		<view class="name fw-bolder">{{renders.switch.name}}</view>
						 	</view>
						 	<view class="right d-flex align-items-center vice_text">
						 		<view class="text">{{renders.switch.value}}</view>
						 		<view class="domxee_icon vice_text">&#xe632;</view>
						 	</view>
						 </view>
					 </view>
				 </view>
			</view>
			<view id="signout">
				<view class="signout d-padding">
						<view class="signout_button button_bg text-center fw-bold" @click="navigateAction('oauth')">退出登录</view>
				</view>
			</view> -->
		</view>
		<u-popup :show="shows.destroy" @close="closePopup('destroy')" mode="bottom" bgColor="transparent">
			<view class="domxee_popup">
				<view class="section" id="destroy_popup">
					<view class="popup_close" @click="closePopup('destroy')"><view class="domxee_icon">&#xe619;</view></view>
					<view class="title fw-bolder main_text text-center">{{renders.popups.destroy.title}}</view>
					<view class="icon domxee_icon color fw-bolder">&#xe72a;</view>
					<view class="description text-center vice_text">{{renders.popups.destroy.tip}}</view>
					<view class="submit d-padding">
						<view class="submit_button button_bg text-center fw-bold" @click="destroyAction">{{renders.popups.destroy.button}}</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="shows.nickname" mode="bottom" bgColor="transparent" :safeAreaInsetBottom="false" @close="shows.nickname = false" :customStyle="{width: '100%'}">
			<view class="domxee_popup">
				<view class="section" id="nickname_popup">
					<view class="popup_close" @click="shows.nickname = false"><view class="domxee_icon">&#xe619;</view></view>
					<view class="title fw-bolder main_text text-center">{{renders.popups.nickname.title}}</view>
					<view class="form_box">
						<view class="form">
							<view class="item">
								<input type="text" class="input page_bg main_text" placeholder-class="vice_text" placeholder="请输入需要修改的昵称" v-model="data.sections.formData.nickname.value" confirm-type="done">
							</view>
						</view>
						<view class="button_bg text-center fw-border" @click="storeNickname">
							{{renders.popups.nickname.button}}
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="shows.mobile" mode="bottom" bgColor="transparent" :safeAreaInsetBottom="false" @close="shows.mobile = false">
			<view class="domxee_popup">
				<view class="section" id="mobile_popup">
					<view class="popup_close" @click="shows.mobile = false"><view class="domxee_icon">&#xe619;</view></view>
					<view class="title fw-bolder main_text text-center">{{renders.popups.mobile.title}}</view>
					<view class="form_box">
						<view class="form">
							<view class="item">
								<view class="name fw-bold">当前手机号码</view>
								<input type="text" class="input page_bg main_text" disabled="" maxlength="11" placeholder-class="vice_text" placeholder="请输入当前手机号码" v-model="data.sections.formData.mobile.mobile" confirm-type="done">
							</view>
							<view class="item">
								<view class="name fw-bold">验证码</view>
								<view class="verify d-flex justify-content-between align-items-center">
									<input type="text" class="input page_bg main_text w-fill-available" maxlength="4" placeholder-class="vice_text" placeholder="请输入验证码" v-model="data.sections.formData.mobile.code" confirm-type="done">
									<view class="button bg text-nowrap text-center" @click="sendVerifyCode('edit_mobile', 'old')" v-if="data.sections.verify_seconds.mobile.old <= 0">获取验证码</view>
									<view class="button bg_less text-nowrap text-center" v-else>剩余 {{data.sections.verify_seconds.mobile.old}} 秒</view>
								</view>
							</view>
							<view class="item">
								<view class="name fw-bold">新手机号码</view>
								<input type="text" class="input page_bg main_text" placeholder-class="vice_text" maxlength="11" placeholder="请输入新的手机号码" v-model="data.sections.formData.mobile.new_mobile" confirm-type="done">
							</view>
							<view class="item">
								<view class="name fw-bold">验证码</view>
								<view class="verify d-flex justify-content-between align-items-center">
									<input type="text" class="input page_bg main_text w-fill-available" maxlength="4" placeholder-class="vice_text" placeholder="请输入验证码" v-model="data.sections.formData.mobile.new_code" confirm-type="done">
									<view class="button bg text-nowrap text-center" @click="sendVerifyCode('edit_mobile', 'new')" v-if="data.sections.verify_seconds.mobile.new <= 0">获取验证码</view>
									<view class="button bg_less text-nowrap text-center" v-else>剩余 {{data.sections.verify_seconds.mobile.new}} 秒</view>
								</view>
							</view>
						</view>
						<view class="tip text-center vice_text">{{renders.popups.mobile.tip}}</view>
						<view class="button_bg text-center fw-border" @click="editMobile">
							{{renders.popups.mobile.button}}
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="shows.password" mode="bottom" bgColor="transparent" :safeAreaInsetBottom="false" @close="shows.password = false">
			<view class="domxee_popup">
				<view class="section" id="password_popup">
					<view class="popup_close" @click="shows.password = false"><view class="domxee_icon">&#xe619;</view></view>
					<view class="title fw-bolder main_text text-center">{{renders.popups.password.title}}</view>
					<view class="form_box">
						<view class="form">
							<view class="item">
								<view class="name fw-bold">当前手机号码</view>
								<input type="text" class="input page_bg main_text" disabled="" placeholder-class="vice_text" placeholder="请输入当前手机号码" v-model="data.sections.formData.password.mobile" confirm-type="done">
							</view>
							<view class="item">
								<view class="name fw-bold">验证码</view>
								<view class="verify d-flex justify-content-between align-items-center">
									<input type="text" class="input page_bg main_text w-fill-available" maxlength="4" placeholder-class="vice_text" placeholder="请输入验证码" v-model="data.sections.formData.password.code" confirm-type="done">
									<view class="button bg text-nowrap text-center" @click="sendVerifyCode('edit_password', '')" v-if="data.sections.verify_seconds.password <= 0">获取验证码</view>
									<view class="button bg_less text-nowrap text-center" v-else>剩余 {{data.sections.verify_seconds.password}} 秒</view>
								</view>
							</view>
							<view class="item">
								<view class="name fw-bold">新密码</view>
								<input type="password" class="input page_bg main_text" placeholder-class="vice_text" placeholder="请输入新的账户密码" v-model="data.sections.formData.password.password" confirm-type="done">
							</view>
							<view class="item">
								<view class="name fw-bold">确认密码</view>
								<input type="password" class="input page_bg main_text" placeholder-class="vice_text" placeholder="请再次输入新的账户密码" v-model="data.sections.formData.password.password_confirmed" confirm-type="done">
							</view>
						</view>
						<view class="tip text-center vice_text">{{renders.popups.password.tip}}</view>
						<view class="button_bg text-center fw-border" @click="editPassword">
							{{renders.popups.password.button}}
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-popup :show="shows.pay_password" mode="bottom" bgColor="transparent" :safeAreaInsetBottom="false" @close="shows.pay_password = false">
			<view class="domxee_popup">
				<view class="section" id="password_popup">
					<view class="popup_close" @click="shows.pay_password = false"><view class="domxee_icon">&#xe619;</view></view>
					<view class="title fw-bolder main_text text-center">{{renders.popups.pay_password.title}}</view>
					<view class="form_box">
						<view class="form">
							<view class="item">
								<view class="name fw-bold">当前手机号码</view>
								<input type="text" class="input page_bg main_text" disabled="" placeholder-class="vice_text" placeholder="请输入当前手机号码" v-model="data.sections.formData.password.mobile" confirm-type="done">
							</view>
							<view class="item">
								<view class="name fw-bold">验证码</view>
								<view class="verify d-flex justify-content-between align-items-center">
									<input type="text" class="input page_bg main_text w-fill-available" maxlength="4" placeholder-class="vice_text" placeholder="请输入验证码" v-model="data.sections.formData.pay_password.code" confirm-type="done">
									<view class="button bg text-nowrap text-center" @click="sendVerifyCode('pay_password', '')" v-if="data.sections.verify_seconds.pay_password <= 0">获取验证码</view>
									<view class="button bg_less text-nowrap text-center" v-else>剩余 {{data.sections.verify_seconds.pay_password}} 秒</view>
								</view>
							</view>
							<view class="item">
								<view class="name fw-bold">新支付密码</view>
								<input type="password" class="input page_bg main_text" placeholder-class="vice_text" placeholder="请输入新的支付密码" v-model="data.sections.formData.pay_password.password" confirm-type="done">
							</view>
							<view class="item">
								<view class="name fw-bold">确认新密码</view>
								<input type="password" class="input page_bg main_text" placeholder-class="vice_text" placeholder="请再次输入新的支付密码" v-model="data.sections.formData.pay_password.password_confirmed" confirm-type="done">
							</view>
						</view>
						<view class="tip text-center vice_text">{{renders.popups.pay_password.tip}}</view>
						<view class="button_bg text-center fw-border" @click="editPayPassword">
							{{renders.popups.pay_password.button}}
						</view>
					</view>
				</view>
			</view>
		</u-popup>
		<u-picker :show="shows.gender" ref="genderPicker" :columns="renders.infos.gender.columns" :cancelColor="globalData.colors.light.main" :confirmColor="globalData.colors.theme.color" title="选择性别" @confirm="confirmGenderPicker" @change="changeGenderPicker" @cancel="closePopup('gender')"></u-picker>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				globalData: {windowWidth: 0, statusBarHeight: 0, navHeight: 0, navigationBarHeight: 0, wechatCapsule: {width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0}, defaultThemes: [], colors: {}, configs: {} },
				scroll: 0,
				current_page: {route: '', params: {}, url: ''},
				ready: false,
				options: {

				},
				styles: {

				},
				shows: {
					destroy: false,
					nickname: false,
					mobile: false,
					password: false,
					pay_password: false,
					gender: false
				},
				renders: {
					main_title: "",
					infos: {
						avatar: {enable: false, name: '', value: ''},
						nickname: {enable: false, name: '', value: ''},
						gender: {enable: false, name: '', value: '', columns: []},
						mobile: {enable: false, name: '', value: '', mobile: ''},
						password: {enable: false, name: '', value: ''},
						pay_password: {enable: false, name: '', value: ''},
						mp_wechat_open_id: {enable: false, name: '', value: ''},
						app_wechat_open_id: {enable: false, name: '', value: ''},
						mini_wechat_open_id: {enable: false, name: '', value: ''},
						qq_token: {enable: false, name: '', value: ''},
						weibo_token: {enable: false, name: '', value: ''},
					},
					tools: {
						feedback: {enable: false, name: ''},
						clear: {enable: false, name: '', value: ''},
						version: {enable: false, name: '', value: ''},
					},
					destroy: {enable: false, name: '', value: ''},
					switch: {enable: false, name: '', value: '', alias: '', params: {}},
					popups: {
						destroy: {title: '', tip: '', button: ''},
						nickname: {title: '', button: ''},
						password: {title: '', tip: '', button: ''},
						pay_password: {title: '', tip: '', button: ''},
						mobile: {title: '', tip: '', button: ''},
					}
				},
				data: {
					sections: {
						formData: {
							nickname: {value: ''},
							gender: {value: ''},
							mobile: {mobile: '', code: '', new_mobile: '', new_code: ''},
							password: {mobile: '', code: '', password: '', password_confirmed: ''},
							pay_password: {mobile: '', code: '', password: '', password_confirmed: ''},
						},
						verify_seconds: {mobile: {old: 0, new: 0}, password: 0, pay_password: 0},
					},
				},
			}
		},
		onReady() {						//页面渲染完毕后操作（动态获取/调整元素宽高位置等需在ready后获取最为准确）
			//设置对象
			let that = this;

		},
		onShow() {						//页面显示后操作（关闭、后台运行等操作后重新打开访问触发、可在实时性较高操作页面进行全页刷新）
			//设置对象
			let that = this;
			//初始数据
			that.initInformation();
		},
		onLoad(options) {				//页面加载时操作（options可获取当前页面传递参数，如：options.id）
			//设置对象
			let that = this;
			//设置当前页面数据
			that.current_page = that.nii_common.pages.getCurrentUrl();
			//设置默认数据
			that.globalData = that.nii_common.pages.initGlobalData(getApp().globalData);
			//设置参数
			that.options = options;
			//初始数据
			that.initInformation();
		},
		methods: {
			//默认跳转操作
			navigateAction: function(alias, requestParams = {}, action = 'navigate', authenticate = false, animationType = 'slide-in-right') {this.nii_common.navigate.action(alias, requestParams, action, authenticate, animationType); },
			//拨打电话
			callPhone: function(mobile) {uni.makePhoneCall({phoneNumber: mobile});},
			//复制数据
			clipboardData: function (text) {const that = this;that.nii_common.clipboardData(text);},
			initInformation: function() {
				//设置对象
				let that = this;
				//loading
				!that.ready && that.nii_common.toastLoading('加载中');
				//开始准备
				that.ready = false;				
				//发起请求
				that.nii_common.request.build('settings/information', {}, 'GET', function (res) {
					//设置准备已就绪
					that.ready = true;
					//设置数据
					that.renders = res.data;
					//设置基础信息
					that.data.sections.formData = {
						nickname: {value: that.renders.infos.nickname.value},
						gender: {value: that.renders.infos.gender.value},
						mobile: {mobile: that.renders.infos.mobile.value, code: '', new_mobile: '', new_code: ''},
						password: {mobile: that.renders.infos.mobile.value, code: '', password: '', password_confirmed: ''},
						pay_password: {mobile: that.renders.infos.mobile.value, code: '', password: '', password_confirmed: ''},
					};
					that.data.sections.verify_seconds = {mobile: {old: 0, new: 0}, password: 0, pay_password: 0};
					//关闭所有弹窗
					that.shows = {
						destroy: false,
						nickname: false,
						mobile: false,
						password: false,
						gender: false,
						pay_password: false,
					};
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			closePopup: function (alias) {
				//获取对象
				const that = this;
				//关闭弹窗
				that.shows[alias] = false;
			},
			clearCache: function () {
				//获取对象
				const that = this;
				//loading
				that.nii_common.toastLoading('缓存清除中...');
				//延迟处理
				setTimeout(function () {					
					//提示成功
					that.nii_common.toastAlert('清除完成', 'success');
					//设置缓存数量
					that.renders.tools.clear.value = '86.5 KB';
				}, 4000);
			},
			destroyAction: function () {
				//获取对象
				const that = this;
				//loading
				that.nii_common.toastLoading('注销中...');
				//发起请求
				that.nii_common.request.build('app/accounts/settings/destroy', {}, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('注销成功', 'success');
					//延迟处理
					setTimeout(function () {
						//跳转登录
						that.navigateAction('oauth');
					}, 1500);
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			uploadAvatar: function() {
				//设置对象
				let that = this;
				//选择图片
				uni.chooseImage({
					count: 1,
					sizeType: ['original', 'compressed'],
					crop: {width: 200, height: 200, quality: 100},
					success: function (res) {
						//loading
						that.nii_common.toastLoading('上传中...');
						//发起请求
						that.nii_common.request.upload('app/uploader', res.tempFilePaths[0], {
							file_type: 'source',
							dictionary: 'accounts/avatars'
						}, 'file', function (res) {
							//loading
							that.nii_common.toastLoading('更改中...');
							//请求获取我的购物车列表
							that.nii_common.request.build('app/accounts/settings/avatar', {avatar: res.data['link']}, 'POST', function (res) {
								//提示成功
								that.nii_common.toastAlert('更改成功', 'success');
								//刷新页面
								that.initInformation();
							}, function (res) {
								//提示失败
								that.nii_common.toastAlert(res.msg);
							}, function () {
								//隐藏loading
								that.nii_common.toastLoadingHide();
							}, true);
						}, function (res) {
							//提示失败
							that.nii_common.toastAlert(res.msg);
						}, function () {
							//隐藏loading
							that.nii_common.toastLoadingHide();
						}, true);
					}
				});
			},
			storeNickname: function() {
				//获取对象
				const that = this;
				//loading
				that.nii_common.toastLoading('修改中...');
				//发起请求
				that.nii_common.request.build('app/accounts/settings/nickname', that.data.sections.formData.nickname, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('修改成功', 'success');
					//刷新页面
					that.initInformation();
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			changeGenderPicker: function(e) {
				//设置对象
				let that = this;
				//获取结果
				const {columnIndex, index, picker = this.$refs.genderPicker } = e;
				//设置街道信息
				that.data.sections.formData.gender.value = that.renders.infos.gender.columns[columnIndex][index];
			},
			confirmGenderPicker: function(e) {
				//设置对象
				let that = this;
				//loading
				that.nii_common.toastLoading('修改中...');
				//发起请求
				that.nii_common.request.build('app/accounts/settings/gender', that.data.sections.formData.gender, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('修改成功', 'success');
					//刷新页面
					that.initInformation();
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			editMobile: function(e) {
				//设置对象
				let that = this;
				//loading
				that.nii_common.toastLoading('修改中...');
				//发起请求
				that.nii_common.request.build('app/accounts/settings/mobile', that.data.sections.formData.mobile, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('修改成功', 'success');
					//刷新页面
					that.initInformation();
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			editPassword: function() {
				//设置对象
				let that = this;
				//loading
				that.nii_common.toastLoading('修改中...');
				//发起请求
				that.nii_common.request.build('user/edit_password', that.data.sections.formData.password, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('修改成功', 'success');
					//刷新页面
					that.initInformation();
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			editPayPassword: function() {
				//设置对象
				let that = this;
				//loading
				that.nii_common.toastLoading('修改中...');
				//发起请求
				that.nii_common.request.build('user/edit_pay_password', that.data.sections.formData.pay_password, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('修改成功', 'success');
					//刷新页面
					that.initInformation();
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			},
			sendVerifyCode: function(alias, action) {
				//设置对象
				let that = this, mobile = '';
				//判断操作类型
				switch (alias) {
					case 'edit_mobile':
						mobile = (action == 'new' ? that.data.sections.formData.mobile.new_mobile : that.renders.infos.mobile.mobile);
					break;
					default:
						mobile = that.renders.infos.mobile.mobile;
					break;
				}
				//验证数据
				if (!uni.$u.test.mobile(mobile)) {
					//提示信息
					return that.nii_common.toastAlert('请输入有效的手机号码');
				}
				//loading
				that.nii_common.toastLoading('正在发送...');
				//发送请求
				that.nii_common.request.build('msg/send_code', {mobile: mobile, alias: alias}, 'POST', function (res) {
					//判断操作类型
					switch (alias) {
						case 'edit_mobile':
							//设置验证码
							that.data.sections.verify_seconds.mobile[action] = 60;
							//开启定时器
							 var timer = setInterval(function () {
								//更新验证码
								that.data.sections.verify_seconds.mobile[action] -= 1;
								//判断数量
								if (that.data.sections.verify_seconds.mobile[action] <= 0) {
									//关闭定时器
									clearInterval(timer);
								}
							 }, 1000);
						break;
						default:
							//设置验证码
							that.data.sections.verify_seconds.password = 60;
							//开启定时器
							 var timer = setInterval(function () {
								//更新验证码
								that.data.sections.verify_seconds.password -= 1;
								//判断数量
								if (that.data.sections.verify_seconds.password <= 0) {
									//关闭定时器
									clearInterval(timer);
								}
							 }, 1000);
						break;
					}
					 //提示成功
					 that.nii_common.toastAlert('发送成功');
				}, function (res) {
					//提示失败
					that.nii_common.toastAlert(res.msg);
				}, function (res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});
			},
			unbindAction: function (platform) {
				//设置对象
				let that = this;
				//弹窗提示
				uni.showModal({
					title: '温馨提示',
					content: '请确认是否解除当前账号授权？',
					confirmColor: that.globalData.colors.theme.color,
					confirmText: '确定',
					cancelText: '取消',
					success:function(res){
						//判断是否确认
						if (res.confirm) {
							//loading
							that.nii_common.toastLoading('解除绑定中...');
							//发起请求
							that.nii_common.request.build('app/accounts/settings/unbind', {platform: platform}, 'POST', function (res) {
								//提示成功
								that.nii_common.toastAlert('解除成功', 'success');
								//刷新页面
								that.initInformation();
							}, function (res) {
								//提示错误
								that.nii_common.toastAlert(res.msg);
							}, function(res) {
								//隐藏loading
								that.nii_common.toastLoadingHide();
							});	
						}
					}
				});
			},
			requestDemo: function() {
				//获取对象
				const that = this;
				//loading
				that.nii_common.toastLoading('处理中...');
				//发起请求
				that.nii_common.request.build('', {}, 'POST', function (res) {
					//提示成功
					that.nii_common.toastAlert('处理成功', 'success');
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				});	
			}
		},
		onPullDownRefresh(res) {
			//设置对象
			let that = this;
			
			//TODO：页面下拉刷新时的事件
			
			
			//停止刷新
			uni.stopPullDownRefresh();	
		},
		onReachBottom() {
			//设置对象
			let that = this;
			
			//TODO：页面滑动触底时的事件
			
		},
		onPageScroll: function(e) {
			//设置页面滑动高度
			this.scroll = e.scrollTop

			//TODO：需判断滑动高度后处理的事件

		}
	}

</script>

<style lang="scss">
	#header_wrapper {
		#title {
			font-size: 40rpx;
			line-height: 48rpx;
			letter-spacing: 1rpx;
			margin-left: 10rpx;
			font-weight: 600;
		}
		.domxee_icon {			
			font-size: 36rpx;
			line-height: 60rpx;
			margin-right: 20rpx;
		}
		.domxee_icon:last-child {
			margin-right: 0;
		}
	}
	#content_wrapper {
		padding-bottom: 300rpx;
		#infos {
			margin-top: 30rpx;
			.infos {
				.infos_box {
					padding: 60rpx 30rpx 40rpx 30rpx;
					border-radius: 20rpx;
					.rows {
						.row {
							margin-top: 50rpx;
							.left {
								.domxee_icon {
									margin-right: 30rpx;
									height: 40rpx;
									width: 40rpx;
									line-height: 40rpx;
									text-align: center;
								}
								.name {
									font-size: 28rpx;
									line-height: 40rpx;
								}
							}
							.right {
								.avatar_box {
									width: 80rpx;
									height: 80rpx;
									border-radius: 80rpx;
									margin-right: 14rpx;
								}
								.text {
									font-size: 24rpx;
									line-height: 34rpx;
									margin-right: 14rpx;
								}
								.domxee_icon {
									height: 40rpx;
									width: 40rpx;
									line-height: 40rpx;
									text-align: center;
								}
							}
						}
						.row:first-child {
							margin-top: 0;
						}
					}
				}
			}
		}
		#tools {
			margin-top: 30rpx;
			.tools {
				.tools_box {
					padding: 40rpx 30rpx;
					border-radius: 20rpx;
					.tool {
						margin-top: 50rpx;
						.left {
							.domxee_icon {
								margin-right: 30rpx;
								height: 40rpx;
								width: 40rpx;
								line-height: 40rpx;
								text-align: center;
							}
							.name {
								font-size: 28rpx;
								line-height: 40rpx;
							}
						}
						.right {
							.text {
								font-size: 24rpx;
								line-height: 34rpx;
								margin-right: 14rpx;
							}
							.domxee_icon {
								height: 40rpx;
								width: 40rpx;
								line-height: 40rpx;
								text-align: center;
							}
						}
					}
					.tool:first-child {
						margin-top: 0;
					}
				}
			}
		}
		#destroy {
			margin-top: 30rpx;
			.destroy {
				.destroy_box {
					padding: 40rpx 30rpx;
					border-radius: 20rpx;
					.row {
						margin-top: 50rpx;
						.left {
							.domxee_icon {
								margin-right: 30rpx;
								height: 40rpx;
								width: 40rpx;
								line-height: 40rpx;
								text-align: center;
							}
							.name {
								font-size: 28rpx;
								line-height: 40rpx;
							}
						}
						.right {
							.text {
								font-size: 24rpx;
								line-height: 34rpx;
								margin-right: 14rpx;
							}
							.domxee_icon {
								height: 40rpx;
								width: 40rpx;
								line-height: 40rpx;
								text-align: center;
							}
						}
					}
					.row:first-child {
						margin-top: 0;
					}
				}
			}
		}
		#switch {
			margin-top: 30rpx;
			.switch {
				.switch_box {
					padding: 40rpx 30rpx;
					border-radius: 20rpx;
					.row {
						margin-top: 50rpx;
						.left {
							.domxee_icon {
								margin-right: 30rpx;
								height: 40rpx;
								width: 40rpx;
								line-height: 40rpx;
								text-align: center;
							}
							.name {
								font-size: 28rpx;
								line-height: 40rpx;
							}
						}
						.right {
							.text {
								font-size: 24rpx;
								line-height: 34rpx;
								margin-right: 14rpx;
							}
							.domxee_icon {
								height: 40rpx;
								width: 40rpx;
								line-height: 40rpx;
								text-align: center;
							}
						}
					}
					.row:first-child {
						margin-top: 0;
					}
				}
			}
		}
		#signout {
			margin-top: 100rpx;
			.signout {
				.signout_button {
					margin: 0 auto;
					text-align: center;
					padding: 28rpx 0;
					width: 580rpx;
					border-radius: 20rpx;
				}
			}
		}
	}
	.domxee_popup {
		.form {
			.item {
				margin-top: 20rpx;
				.name {
					font-size: 24rpx;
					line-height: 34rpx;
				}
				.input {
					padding: 20rpx 30rpx;
					margin-top: 20rpx;
					border-radius: 20rpx;
					font-size: 24rpx;
					line-height: 34rpx;
				}
				.verify {
					margin-top: 20rpx;
					.input {
						margin-top: 0;
						font-size: 28rpx;
						line-height: 40rpx;
						margin-right: 30rpx;
					}
					.button {
						width: 160rpx;
						border-radius: 10rpx;
						width: 230rpx;
						padding: 24rpx;
						font-size: 24rpx;
						line-height: 34rpx;
					}
				}
			}
			.item:first-child {
				margin-top: 0;
			}
		}
		.tip {
			margin-top: 50rpx;
			font-size: 24rpx;
			line-height: 34rpx;
		}
		.button_bg {
			margin: 30rpx auto 0 auto;
			border-radius: 20rpx;
			padding: 20rpx;
		}
	}
	#destroy_popup {
		.title {
			font-size: 36rpx;
			line-height: 50rpx;
		}
		.icon {
			width: 175rpx;
			height: 175rpx;
			margin: 50rpx auto 0 auto;
			line-height: 175rpx;
			font-size: 150rpx;
		}
		.description {
			margin-top: 50rpx;
			font-size: 24rpx;
			line-height: 34rpx;
		}
		.submit {
			margin-top: 50rpx;
			.submit_button {			
				width: 580rpx;
				margin: 0 auto;
				padding: 28rpx 0;	
			}
		}
	}
</style>
